import Vue from 'vue';
import confirm from './rm_Login_Comm.vue';

let ConfirmConstructor = Vue.extend(confirm);
let rm_Login = function(text) {
    return new Promise((res, rej) => { //promise封装，confirm执行res，cancel执行rej
        let confirmDom = new ConfirmConstructor({
            el: document.createElement('div')
        })
        document.body.appendChild(confirmDom.$el); //new一个对象插入body里面
        confirmDom.text = text;
        confirmDom.isLogSuccess = function() {
            res({
                flag: confirmDom.logflag,
                userid: confirmDom.userid,
                username: confirmDom.username,
                rejectreason: confirmDom.rejectreason,
                loginalertflag: confirmDom.loginalertflag,

            })
        }
        confirmDom.cancel = function() {
            rej();
            confirmDom.isShow = false;
        }
    })
}
export default rm_Login;
